/* eslint valid-jsdoc: "off" */

"use strict";

/**
 * @param {Egg.EggAppInfo} appInfo app info
 */
module.exports = (appInfo) => {
    /**
     * built-in config
     * @type {Egg.EggAppConfig}
     **/
    const config = (exports = {});

    // use for cookie sign key, should change to your own and keep security
    config.keys = appInfo.name + "_1591502878628_7447";

    // add your middleware config here
    config.middleware = [];

    // add your user config here
    const userConfig = {
        // myAppName: 'egg',
    };

    config.mysql = {
        // database configuration
        client: {
            // host
            host: "localhost",
            // port
            // port: "3307",//本地
            port: "3306", //服务器
            // username
            user: "root",
            // password
            password: "12345678",
            // database
            database: "react_blog",
        },
        // load into app, default is open
        app: true,
        // load into agent, default is close
        agent: false,
    };

    config.security = {
        csrf: {
            enable: false,
        },
        scrf: {
            enable: false,
        },
    };
    config.cors = {
        origin: "*", //博客端可通过http://49.235.182.135:3000访问
        // origin: "http://49.235.182.135", //可后台通过http://49.235.182.135访问
        // origin: "http://localhost:3001",//本地开发
        credentials: true, //允许Cook可以跨域
        allowMethods: "GET,HEAD,PUT,POST,DELETE,PATCH,OPTIONS",
    };

    return {
        ...config,
        ...userConfig,
    };
};
